<!DOCTYPE html>
<html lang="en" class="js csstransforms3d">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="generator" content="Hugo 0.20.7" />
    <meta name="description" content="">


    <link rel="shortcut icon" href="http://shardingjdbc.io/document/legacy/2.x/en/img/favicon.png" type="image/x-icon" />

    
    <title>Overview</title>
    <link href="http://ovfotjrsi.bkt.clouddn.com/docs/css/nucleus.css" rel="stylesheet">
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="http://ovfotjrsi.bkt.clouddn.com/docs/css/theme.css" rel="stylesheet">
    <link href="http://ovfotjrsi.bkt.clouddn.com/docs/css/hugo-theme.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <style type="text/css">:root #header + #content > #left > #rlblock_left
    {display:none !important;}</style>
    <link rel="stylesheet" href="http://cdn.bootcss.com/highlight.js/9.8.0/styles/monokai-sublime.min.css">
<link rel="stylesheet" href="http://ovfotjrsi.bkt.clouddn.com/docs/css/style.css">
  </head>
  <body class="" data-url="/00-overview/">
    
    <nav id="sidebar">
  <div id="header-wrapper">
    <div id="header">
      <img src="http://ovfotjrsi.bkt.clouddn.com/docs/img/sharding-jdbc.png" />
    </div>
</div>
  <div class="highlightable">
    <ul class="topics">
      
        
        
          
          
            
          
        
          
          
            
          
        
          
          
            
          
        
          
          
            
          
        
        
        
          
        
          
        
          
        
          
        
      
      
      
      

      
      
      
        
          
          
            
          
        
      
      
      

      <li class="dd-item active parent" data-nav-id="/00-overview/">
        <a href="http://shardingjdbc.io/document/legacy/2.x/en/00-overview/">
          <span>
            
              <b>0. </b>
            
             Overview
            
           </span>
        </a>
        
        <ul>
          
            <li class="dd-item " data-nav-id="/00-overview/intro/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/00-overview/intro/">
                <span>Brief Introduction     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/00-overview/news/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/00-overview/news/">
                <span>News     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/00-overview/contribution/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/00-overview/contribution/">
                <span>Contribute Code     </i></span>
              </a>
            </li>
          
        </ul>
        
      </li>
      
      
      

      
      
      
        
          
          
            
          
        
      
      
      

      <li class="dd-item  " data-nav-id="/01-start/">
        <a href="http://shardingjdbc.io/document/legacy/2.x/en/01-start/">
          <span>
            
              <b>1. </b>
            
             Introduction
            
           </span>
        </a>
        
        <ul>
          
            <li class="dd-item " data-nav-id="/01-start/quick-start/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/01-start/quick-start/">
                <span>Quick Start     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/01-start/code-demo/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/01-start/code-demo/">
                <span>Usage Example     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/01-start/faq/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/01-start/faq/">
                <span>FAQ     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/01-start/features/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/01-start/features/">
                <span>Feature List     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/01-start/limitations/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/01-start/limitations/">
                <span>Use Limits     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/01-start/sql-supported/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/01-start/sql-supported/">
                <span>The list of available SQL syntax     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/01-start/stress-test/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/01-start/stress-test/">
                <span>The performance-test report     </i></span>
              </a>
            </li>
          
        </ul>
        
      </li>
      
      
      

      
      
      
        
          
          
            
          
        
      
      
      

      <li class="dd-item  " data-nav-id="/02-guide/">
        <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/">
          <span>
            
              <b>2. </b>
            
             User Manual
            
           </span>
        </a>
        
        <ul>
          
            <li class="dd-item " data-nav-id="/02-guide/concepts/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/concepts/">
                <span>Basic Concepts      </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/sharding/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/sharding/">
                <span>Sharding     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/master-slave/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/master-slave/">
                <span>Read-write splitting     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/config_domain/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/config_domain/">
                <span>Domain Model Configuration     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/configuration/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/configuration/">
                <span>Configuration     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/orchestration/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/orchestration/">
                <span>Orchestration     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/hint-sharding-value/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/hint-sharding-value/">
                <span>Mandatory Routing     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/key-generator/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/key-generator/">
                <span>Distributed Primary key     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/transaction/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/transaction/">
                <span>Transaction Support     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/subquery/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/subquery/">
                <span>The Pagination and subquery     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/test-framework/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/test-framework/">
                <span>Test Engine     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/apm/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/apm/">
                <span>APM     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/02-guide/sharding-jdbc-server/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/02-guide/sharding-jdbc-server/">
                <span>Sharding-JDBC-Server     </i></span>
              </a>
            </li>
          
        </ul>
        
      </li>
      
      
      

      
      
      
        
          
          
            
          
        
      
      
      

      <li class="dd-item  " data-nav-id="/03-design/">
        <a href="http://shardingjdbc.io/document/legacy/2.x/en/03-design/">
          <span>
            
              <b>3. </b>
            
             Design Plan
            
           </span>
        </a>
        
        <ul>
          
            <li class="dd-item " data-nav-id="/03-design/architecture/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/03-design/architecture/">
                <span>Architecture Design     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/03-design/module/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/03-design/module/">
                <span>Module Declaration     </i></span>
              </a>
            </li>
          
            <li class="dd-item " data-nav-id="/03-design/roadmap/">
              <a href="http://shardingjdbc.io/document/legacy/2.x/en/03-design/roadmap/">
                <span>Roadmap     </i></span>
              </a>
            </li>
          
        </ul>
        
      </li>
      
      
    </ul>
    <hr>
     
  </div>
</nav>

        <section id="body">
        <div id="overlay"></div>

        <div class="padding highlightable">

            <div id="top-bar">
              
              <div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
                  <span id="sidebar-toggle-span">
                      <a href="#" id="sidebar-toggle" data-sidebar-toggle="">
                        <i class="fa fa-bars"></i>
                      </a>
                  </span>
                
                
                  
                  
                  
                    
                    
                  
                
                <span itemprop="title"> Overview</span>
              </div>
              

            </div>
            
              <div id="chapter">
            
              <div id="body-inner">
                



<h1 id="overview">Overview</h1>

<p><a href="https://github.com/shardingjdbc/sharding-jdbc/releases"><img src="https://img.shields.io/github/release/shardingjdbc/sharding-jdbc.svg?style=social&amp;label=Release" alt="GitHub release" /></a>&nbsp;
<a href="https://github.com/shardingjdbc/sharding-jdbc/stargazers"><img src="https://img.shields.io/github/stars/shardingjdbc/sharding-jdbc.svg?style=social&amp;label=Star" alt="GitHub stars" /></a>&nbsp;
<a href="https://github.com/shardingjdbc/sharding-jdbc/fork"><img src="https://img.shields.io/github/forks/shardingjdbc/sharding-jdbc.svg?style=social&amp;label=Fork" alt="GitHub forks" /></a>&nbsp;
<a href="https://github.com/shardingjdbc/sharding-jdbc/watchers"><img src="https://img.shields.io/github/watchers/shardingjdbc/sharding-jdbc.svg?style=social&amp;label=Watch" alt="GitHub watchers" /></a></p>

<p>Sharding-JDBC: A data sharding, read-write splitting, BASE transaction and database orchestration middleware. It provides maximum compatibilities for applications by JDBC and MySQL protocol.</p>

<p><a href="https://www.apache.org/licenses/LICENSE-2.0.html"><img src="https://img.shields.io/badge/license-Apache%202-4EB1BA.svg" alt="License" /></a></p>

<p><a href="https://maven-badges.herokuapp.com/maven-central/io.shardingjdbc/sharding-jdbc"><img src="https://maven-badges.herokuapp.com/maven-central/io.shardingjdbc/sharding-jdbc/badge.svg" alt="Maven Status" /></a>
<a href="https://github.com/shardingjdbc/sharding-jdbc/releases"><img src="https://img.shields.io/github/release/shardingjdbc/sharding-jdbc.svg" alt="GitHub release" /></a>

<p><a href="https://travis-ci.org/shardingjdbc/sharding-jdbc"><img src="https://secure.travis-ci.org/shardingjdbc/sharding-jdbc.png?branch=master" alt="Build Status" /></a>
<a href="https://codecov.io/github/shardingjdbc/sharding-jdbc?branch=master"><img src="https://codecov.io/github/shardingjdbc/sharding-jdbc/coverage.svg?branch=master" alt="Coverage Status" /></a>
<a href="https://gitter.im/Sharding-JDBC/shardingjdbc?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge"><img src="https://badges.gitter.im/Sharding-JDBC/shardingjdbc.svg" alt="Gitter" /></a>
<a href="http://opentracing.io"><img src="https://img.shields.io/badge/OpenTracing--1.0-enabled-blue.svg" alt="OpenTracing-1.0 Badge" /></a>
<a href="https://github.com/OpenSkywalking/skywalking"><img src="https://img.shields.io/badge/Skywalking%20Tracing-enable-brightgreen.svg" alt="Skywalking Tracing" /></a></p>

<h1 id="features">Features</h1>

<h2 id="1-data-sharding">1. Data sharding</h2>

<ul>
<li>Both databases and tables sharding supported.</li>
<li>Standard aggregation functions, GROUP BY, ORDER BY, LIMIT and JOIN DQL supported.</li>
<li>Standard DML, DDL, TCL and database administrator command supported.</li>
<li>Sharding operator <code>=</code>, <code>BETWEEN</code> and <code>IN</code> supported.</li>
<li>Sharding algorithm customization and inline expression supported.</li>
<li>Route by hint supported.</li>
<li>Distributed sequence supported.</li>
</ul>

<h2 id="2-read-write-splitting">2. Read-write splitting</h2>

<ul>
<li>Multiple slaves replica supported.</li>
<li>Data consistency guarantee in same thread supported.</li>
<li>Mix read-write splitting and data sharding supported.</li>
<li>Route by hint supported.</li>
</ul>

<h2 id="3-base-transaction">3. BASE Transaction</h2>

<ul>
<li>Best efforts delivery transaction supported.</li>
<li>Try confirm cancel transaction (TBD).</li>
</ul>

<h2 id="4-orchestration">4. Orchestration</h2>

<ul>
<li>Configuration center supported, can refresh dynamically.</li>
<li>Circuit breaker supported.</li>
<li>Open tracing supported.</li>
</ul>

<h1 id="architecture">Architecture</h1>

<h2 id="sharding-jdbc">Sharding-JDBC</h2>

<p>Use JDBC connect databases without redirect cost for java application, best performance for production.</p>

<ul>
<li>ORM compatible. JPA, Hibernate, Mybatis, Spring JDBC Template or JDBC supported.</li>
<li>Connection-pool compatible. DBCP, C3P0, BoneCP, Druid supported.</li>
<li>Multi SQL-based databases compatible. Any Database supported theoretically. Support MySQL, Oracle, SQLServer and PostgreSQL right now.</li>
</ul>

<p><img src="http://ovfotjrsi.bkt.clouddn.com/jdbc_brief_en.png" alt="Sharding-JDBC Architecture" /></p>

<h2 id="sharding-proxy">Sharding-Proxy</h2>

<p>Database router. Deploy as a stateless server, support MySQL protocol for now.</p>

<ul>
<li>Use standard MySQL protocol, application do not care about whether proxy or real MySQL.</li>
<li>Any MySQL command line and UI workbench supported in theoretically. MySQL Workbench are fully compatible right now.</li>
</ul>

<p><img src="http://ovfotjrsi.bkt.clouddn.com/proxy_brief_en.png" alt="Sharding-Proxy Architecture" /></p>

<h2 id="sharding-sidecar-tbd">Sharding-Sidecar(TBD)</h2>

<p>Use sidecar to connect databases, best for Kubernetes or Mesos together.</p>

<p><img src="http://ovfotjrsi.bkt.clouddn.com/sidecar_brief_v2_en.png" alt="Sharding-Sidecar Architecture" /></p>

<h1 id="quick-start">Quick Start</h1>

<h2 id="sharding-jdbc-1">Sharding-JDBC</h2>

<h3 id="add-maven-dependency">Add maven dependency</h3>

<pre><code class="language-xml">&lt;!-- import sharding-jdbc core --&gt;
&lt;dependency&gt;
    &lt;groupId&gt;io.shardingjdbc&lt;/groupId&gt;
    &lt;artifactId&gt;sharding-jdbc-core&lt;/artifactId&gt;
    &lt;version&gt;${latest.release.version}&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>

<h3 id="configure-sharding-rule">Configure sharding rule</h3>

<p>Sharding-JDBC support 4 types for sharding rule configuration, they are <code>Java</code>, <code>YAML</code>, <code>Spring namespace</code> and <code>Spring boot starter</code>. Developers can choose any one for best suitable situation.</p>

<h3 id="create-datasource">Create DataSource</h3>

<p>Use ShardingDataSourceFactory to create ShardingDataSource, which is a standard JDBC DataSource. Then developers can use it for raw JDBC, JPA, MyBatis or Other JDBC based ORM frameworks.</p>

<pre><code class="language-java">DataSource dataSource = ShardingDataSourceFactory.createDataSource(dataSourceMap, shardingRuleConfig);
</code></pre>

<h2 id="sharding-proxy-1">Sharding-Proxy</h2>

<h3 id="configure-sharding-rule-1">Configure sharding rule</h3>

<p>Edit <code>${sharding-proxy}\conf\sharding-config.yaml</code>. Same format with Sharding-JDBC-Driver&rsquo;s <code>YAML</code> configuration.</p>

<h3 id="start-server">Start server</h3>

<pre><code class="language-shell">${sharding-proxy}\bin\start.sh ${port}
</code></pre>


      
      
        </div> 
      
      </div>
    </div>

    

    <div id="navigation">
        
        <a class="nav nav-prev" href="http://shardingjdbc.io/document/legacy/2.x/en/03-design/roadmap/"> <i class="fa fa-chevron-left"></i></a>
        <a class="nav nav-next" href="http://shardingjdbc.io/document/legacy/2.x/en/00-overview/intro/" style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a>
    </div>

    </section>
    <div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
      <div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
    </div>
    <script src="http://ovfotjrsi.bkt.clouddn.com/docs/js/clipboard.min.js"></script>
    <script src="http://ovfotjrsi.bkt.clouddn.com/docs/js/perfect-scrollbar.min.js"></script>
    <script src="http://ovfotjrsi.bkt.clouddn.com/docs/js/perfect-scrollbar.jquery.min.js"></script>
    <script src="http://ovfotjrsi.bkt.clouddn.com/docs/js/jquery.sticky-kit.min.js"></script>
    <script src="http://ovfotjrsi.bkt.clouddn.com/docs/js/featherlight.min.js"></script>
    <script src="http://ovfotjrsi.bkt.clouddn.com/docs/js/html5shiv-printshiv.min.js"></script>
    <script src="http://ovfotjrsi.bkt.clouddn.com/docs/js/highlight.pack.js"></script>
    <script>hljs.initHighlightingOnLoad();</script>
    <script src="http://ovfotjrsi.bkt.clouddn.com/docs/js/learn.js"></script>
    <script src="http://ovfotjrsi.bkt.clouddn.com/docs/js/hugo-learn.js"></script>
    <script src="http://cdn.bootcss.com/highlight.js/9.8.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

  </body>
</html>

